<?php
namespace Commons\MobileControl;

use Commons\Http;

class Car extends Base
{
    /**
     * @param array  $params
     * @param string $method
     *
     * @return mixed|\Psr\Http\Message\ResponseInterface|\Psr\Http\Message\StreamInterface
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function query(array $params, string $method)
    {
        try {
            if (!is_array($params) || count($params) == 0) {
                throw new \Exception('参数丢失或者格式不正确！');
            }
            if ($method == '') {
                throw new \Exception('接口方法不能为空');
            }
            $api    = $this->prepare($params, $method);
            $result = Http::request($api, 'GET');
            return $result;
        } catch (\Exception $ex) {
            throw new \Exception($ex->getMessage());
        }
        return $result;
    }
}
